# Triangle number
# T(n) = 1 + 2 + ... + n
# T(n) = n*(n + 1)/2
# D(T(n)) = number of T(n) divisor
#
# n and n+1 are always coprime
# D(T(n)) = D(n/2) * D(n+1)   if n even
# D(T(n)) = D(n) * D((n+1)/2) if n odd
#
# n = p1^e1 + p2^e2 + ... + pn^en
# D(n) = 1 * (e1 + 1) * (e2 + 1) * ... * (en + 1)

import lib.prime

prime = lib.prime.Prime(65000)

def D(n):
    result = 1
    for p in prime:
        e = 1
        while n % p == 0:
            n /= p
            e += 1
        result *= e
        if n == 1:
            return result

def Solve():
    n = 1
    dn, dn1 = 0, 1
    while dn * dn1 <= 500:
        n += 1
        dn = dn1
        if n % 2 == 0:
            dn1 = D(n + 1)
        else:
            dn1 = D((n + 1)/2)

    return n*(n + 1)/2





